package loengud.w11;

import java.util.*;

/**
 * Simple demo that uses java.util.Timer to schedule a task 
 * to execute once 5 seconds have passed.
 */
public class Reminder {
	Timer timer;
	
	public Reminder(int seconds) {
		timer = new Timer();
		timer.schedule(new ReminderTask(), seconds * 1000);
	}
	class ReminderTask extends TimerTask {
		@Override
		public void run() {
			System.out.println("Time's up");
			timer.cancel();
		}
	}

	public static void main(String args[]) {
		new Reminder(3);
		System.out.println("Task scheduled");
	}
}
